<script type="text/javascript">

RED.nodes.registerType('xiaoai-tts', {
  category: '小米',
  color: '#7ac6cb',
  paletteLabel: '小爱tts',
  label () {
    return this.name || '小爱tts'
  },
  defaults: {
    name: {
      value: ''
    },
    xiaoai: {
      value: '',
      type: 'xiaoai-tts-configurator'
    },
    tts: {
      value: ''
    },
    device: {
      value: ''
    }

  },
  inputs: 1,
  outputs: 2,
  icon: 'tts.svg'
})

RED.nodes.registerType('xiaoai-devices', {
  category: '小米',
  color: '#7ac6cb',
  paletteLabel: '设备列表',
  label () {
    return this.name || '设备列表'
  },
  defaults: {
    name: {
      value: ''
    },
    xiaoai: {
      value: '',
      type: 'xiaoai-tts-configurator'
    }

  },
  inputs: 1,
  outputs: 1,
  icon: 'devices.svg'
})

</script>

<script type="text/x-red" data-template-name="xiaoai-tts">
      <div class="form-row">
        <label for="node-input-xiaoai"><i class="icon-tag"></i>配置</label>
        <input type="text" id="node-input-xiaoai">
      </div>
      <div class="form-row">
        <label for="node-input-name"><i class="icon-tag"></i>名称</label>
        <input type="text" id="node-input-name">
      </div>
      <div class="form-row">
        <label for="node-input-tts"><i class="icon-tag"></i>tts文本</label>
        <input type="text" id="node-input-tts" placeholder="需要tts的文本">
      </div>

      <div class="form-row">
        <label for="node-input-device"><i class="icon-tag"></i>默认设备</label>
        <input type="text" id="node-input-device" placeholder="默认设备id">
      </div>

      <div class="form-row">
        <label style="width: 100%;text-align: right;padding-right: 34px;box-sizing: border-box;" >
          <a href="https://bbs.iobroker.cn" target="_blank">此节点由 (ioBroker中国|智能家居)提供</a>
        </label>
      </div>
</script>
<script type="text/x-red" data-help-name="xiaoai-tts">
  <p>小爱音箱tts,节点里面实现了默认的队列信息,所以如果在多个NodeRed界面使用,请使用link节点连接到统一的tts节点</p>
  <p>不然可能引起播报信息错乱等异常信息</p>
  <h3>输入</h3>
  <dl class="message-properties">
      <dt>payload
          <span class="property-type">string</span>
      </dt>
      <dd>tts信息</dd>
      <dt>device
        <span class="property-type">string</span>
      </dt>
      <dd>设备唯一标识,用户指定tts设备</dd>
      <dt>sleepTime
        <span class="property-type">number</span>
      </dt>
      <dd>消息播报之间时间间隔, 默认1s</dd>

  </dl>
  <h3>输出</h3>
  <p>当发生错误的时候，将会从输出2里面输出msg.payload = {} ,如果需要请做相关业务处理</p>
  <p>其余信息查看输出</p>

</script>

<script type="text/x-red" data-template-name="xiaoai-devices">
    <div class="form-row">
      <label for="node-input-xiaoai"><i class="icon-tag"></i>配置</label>
      <input type="text" id="node-input-xiaoai">
    </div>
    <div class="form-row">
      <label for="node-input-name"><i class="icon-tag"></i>名称</label>
      <input type="text" id="node-input-name">
    </div>

    <div class="form-row">
      <label style="width: 100%;text-align: right;padding-right: 34px;box-sizing: border-box;" >
        <a href="https://bbs.iobroker.cn" target="_blank">此节点由 (ioBroker中国|智能家居)提供</a>
      </label>
    </div>
</script>
<script type="text/x-red" data-help-name="xiaoai-devices">

  <p>获取小爱音箱设备列表信息,这个用于tts手动选择设备</p>

</script>
